<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="区">
        <el-select v-model="queryParams.value1" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="开始时间">
        <el-date-picker
          format="yyyy-MM-dd"
          v-model="queryParams.value2"
          type="date"
          placeholder="选择日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束时间">
        <el-date-picker
          format="yyyy-MM-dd"
          v-model="queryParams.value3"
          type="date"
          placeholder="选择日期"
        >
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          v-hasPermi="['monitor:operlog:export']"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="noticeList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" type="index" />
      <el-table-column label="区" align="center" prop="value1">
      </el-table-column>
      <el-table-column label="日期" width="100" align="center" prop="value2">
      </el-table-column>
      <el-table-column
        label="未使用入库功能学校数"
        width="200"
        align="center"
        prop="value3"
      >
      </el-table-column>
      <el-table-column
        label="未使用出库功能学校数"
        width="200"
        align="center"
        prop="value4"
      >
      </el-table-column>
      <el-table-column
        label="未使用陪餐记录功能学校数"
        width="200"
        align="center"
        prop="value5"
      >
      </el-table-column>
      <el-table-column
        label="未使用食谱功能学校数"
        width="200"
        align="center"
        prop="value5"
      >
      </el-table-column>
      <el-table-column
        label="未使用食品留样功能学校数"
        width="200"
        align="center"
        prop="value5"
      >
      </el-table-column>
      <el-table-column
        label="未使用消毒记录功能学校数"
        width="200"
        align="center"
        prop="value5"
      >
      </el-table-column>
      <el-table-column
        label="未使用晨检记录功能学校数"
        width="200"
        align="center"
        prop="value5"
      >
      </el-table-column>
      <el-table-column
        label="操作"
        fixed="right"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template>
          <el-button
            size="mini"
            type="text"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>

export default {
  dicts: ["sys_notice_status", "sys_notice_type"],
  data() {
    return {
      options: [],
      value1: "",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 公告表格数据
      noticeList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        value1: '',
        value2: '',
        value3: '',
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询公告列表 */
    getList() {
      // this.loading = true;
      // listNotice(this.queryParams).then(response => {
      //   this.noticeList = response.rows;
      //   this.total = response.total;
      this.noticeList = [
        {
          value1:'鼓楼区',
          value2:'2025-6-15',
          value3:'0',
          value4:'0',
          value5:'0'
        }
      ]
      this.loading = false;
      // });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams= {
        pageNum: 1,
        pageSize: 10,
        value1: '',
        value2: '',
        value3: '',
      }
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.noticeId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.noticeId != undefined) {
            updateNotice(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addNotice(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    }
  },
};
</script>
